<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "order".
 *
 * @property integer $id
 * @property string $logistics_code
 * @property string $opt_time
 * @property string $orderno
 * @property string $store_code
 * @property string $user_name
 * @property string $user_phone
 * @property string $user_address
 * @property string $user_logitude
 * @property string $user_latiude
 * @property string $weight
 * @property string $distince
 * @property string $carrier_no
 * @property integer $package_num
 * @property string $expectpick_time
 * @property string $expect_time
 * @property string $remark
 * @property integer $source
 * @property integer $status
 * @property integer $sub_status
 * @property string $sub_status_desc
 * @property string $sender_name
 * @property string $sender_phone
 * @property integer $sender_user_id
 * @property string $receive_th_data_time
 * @property string $receive_data_time
 * @property string $receive_entity_time
 * @property string $dispatching_time
 * @property string $cancel_time
 * @property string $exception_time
 * @property string $sign_time
 * @property string $cost
 * @property integer $business_type
 */
class Order extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'order';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['opt_time', 'expectpick_time', 'expect_time', 'receive_th_data_time', 'receive_data_time', 'receive_entity_time', 'dispatching_time', 'cancel_time', 'exception_time', 'sign_time'], 'safe'],
            [['user_logitude', 'user_latiude', 'weight', 'distince', 'cost'], 'number'],
            [['package_num', 'source', 'status', 'sub_status', 'sender_user_id','business_type'], 'integer'],
            [['logistics_code'], 'string', 'max' => 12],
            [['orderno'], 'string', 'max' => 20],
            [['store_code', 'carrier_no'], 'string', 'max' => 10],
            [['user_name', 'sender_name'], 'string', 'max' => 50],
            [['user_phone', 'sender_phone'], 'string', 'max' => 11],
            [['user_address', 'sub_status_desc'], 'string', 'max' => 255],
            [['remark'], 'string', 'max' => 512],
            [['orderno'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'logistics_code' => '物流商编号',
            'opt_time' => '操作时间',
            'orderno' => '订单号',
            'store_code' => '门店编码',
            'user_name' => '收件人姓名',
            'user_phone' => '收件人电话',
            'user_address' => '收件人地址',
            'user_logitude' => '收件人经度',
            'user_latiude' => '收件人纬度',
            'weight' => '订单总重量',
            'distince' => '门店到收货人的骑行距离',
            'carrier_no' => '取货号',
            'package_num' => '包数量',
            'expectpick_time' => '天虹要求上门取货时间',
            'expect_time' => '送达时间',
            'remark' => '顾客备注',
            'source' => '来源  1-手工录入 ，2-导入 ,3-天虹推送过来',
            'status' => '主状态  1-待领件，2-已接收数据，3-已接收实物，4-派件员配送中，5-签收，6-取消  7-异常',
            'sub_status' => '子状态  当主状态是6时子状态才会变化',
            'sub_status_desc' => '子状态说明',
            'sender_name' => '派送员姓名',
            'sender_phone' => '派送员手机',
            'sender_user_id' => '配送员ID',
            'receive_th_data_time' => '接收天虹数据时间',
            'receive_data_time' => '配送员取单时间',
            'receive_entity_time' => '配送员取货时间',
            'dispatching_time' => '配送员配送时间',
            'cancel_time' => '取消配送时间',
            'exception_time' => '上报异常时间',
            'sign_time' => '妥投时间',
            'cost' => '费用',
            'business_type' => '业务分类 1-天虹宅配 2-天虹到家',
        ];
    }
}
